package com.bawei.club.test.leakcanary;

import android.content.Context;

/**
 * @author yaotianxue
 * @description
 * @date 2025/6/6
 */
public class UserManager {
    private Context context;
    private UserManager(Context context){
        this.context = context;
    }
    private static volatile UserManager instance;
    public static UserManager getInstance(Context context){
        if (instance == null){//不需要每次判断锁，提高性能
            synchronized (UserManager.class){
                if (instance == null){//保证只有一个实例
                    instance = new UserManager(context);
                }
            }
        }
        return instance;
    }
}
